package com.jdew.thkj.activity;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.jdew.thkj.R;
import com.jdew.thkj.base.BaseActivity;
import com.jdew.thkj.utils.ToastUtils;

import butterknife.Bind;

public class OrderSearchActivity extends BaseActivity {
    @Bind(R.id.back)
    ImageView back;
    @Bind(R.id.title)
    TextView title;
    @Bind(R.id.orderNo)
    EditText orderNo;
    @Bind(R.id.search)
    TextView search;

    @Override
    public int bindLayout() {
        return R.layout.activity_order_search;
    }

    @Override
    public void initView(View view) {
        back.setVisibility(View.VISIBLE);
        title.setText("订单查询");
        back.setOnClickListener(this);
        search.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.back: {
                finish();
            }
            break;
            case R.id.search: {
                if(TextUtils.isEmpty(orderNo.getText())){
                    ToastUtils.getInstance(this).showMessage("请输入订单编号");
                    return;
                }
                Intent in=new Intent(this,OrderDetailActivity.class);
                in.putExtra("orderNo",orderNo.getText().toString());
                startActivity(in);
            }
            break;
            default:
                break;
        }
    }
}
